﻿Public Class frmRendezAlerte
    Dim screenSize As Integer = Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height
    Dim positionFinal As Integer = My.Computer.Screen.Bounds.Height - 232 - screenSize
    Private Sub Frm_Tanbih_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Partager.flag = False
        'Frm_Main.ShowTimer.Interval = 1000
        Me.Location = New Point(My.Computer.Screen.Bounds.Width - Me.Width, My.Computer.Screen.Bounds.Height)
        openTimer.Start()
        My.Computer.Audio.Play(My.Resources.Alert, AudioPlayMode.Background)
        Label1.Text = "لديك موعد مع السيد(ة) " & Partager.rendVsStruct.rendezVous.Nom_complet & " على الساعة " & Partager.rendVsStruct.rendezVous.Heure
    End Sub
    Private Sub openTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles openTimer.Tick
        ' Me.Location = New Point(Me.Location.X, positionFinal)
        If Me.Location.Y <= positionFinal Then
            openTimer.Stop()
            lifeTimer.Start()
        Else
            Me.Location = New Point(My.Computer.Screen.Bounds.Width - Me.Width, Me.Location.Y - 4)
        End If
    End Sub

    Private Sub closeTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles closeTimer.Tick
        If Me.Location.Y >= My.Computer.Screen.Bounds.Height Then
            closeTimer.Stop()
            lifeTimer.Stop()
            Me.Close()
        Else
            Me.Location = New Point(My.Computer.Screen.Bounds.Width - Me.Width, Me.Location.Y + 4)
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        closeTimer.Start()
        My.Computer.Audio.Stop()
        Partager.isRendezVousAdd = True
    End Sub

    Private Sub lifeTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lifeTimer.Tick
        closeTimer.Start()
    End Sub
    Private Sub Btn_detail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_detail.Click
        Partager.detail = True 'Pour indiquer qu'on est venu de ce form
        Partager.isRendezVousAdd = True
        My.Computer.Audio.Stop()
        Partager.StandardInitial()
        Partager.verifPriv(Frm_mawa3id)
        closeTimer.Start()
    End Sub

    Private Sub frmRendezAlerte_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        Partager.isRendezVousAdd = True
        Partager.thrd2.Abort()
    End Sub
End Class